package com.ybg.model;

import com.alibaba.fastjson.annotation.JSONType;

/**
 * HTTP响应体。所有ResponseBody应继承于本类。
 * 
 * @author ningjh
 * @since  2016-07-20
 */
@JSONType(orders = {"code", "msg", "data"})
public class ResponseModel {
	/** 响应代码 */
	private String code;
	
	/** 消息描述 */
	private String msg;
	
	/** 响应数据。只能是字符串，或对象，不允许数字类型 */
	private Object data;
	
	public ResponseModel() {
		this("");
	}
	
	public ResponseModel(Object data) {
		this("0", "ok", data);
	}
	
	public ResponseModel(String code, String msg) {
		this(code, msg, "");
	}
	
	public ResponseModel(String code, String msg, Object data) {
		this.code = code;
		this.msg  = msg;
		this.data = data;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
